/*
 * From https://github.com/pinggod/hexo-theme-apollo/blob/master/source/scss/_partial/post.scss
 */

code,
pre {
  font-size: 0.8em;
  background-color: #f8f8f8;
  font-family: 'Roboto Mono', Monaco, courier, monospace;
}

code {
  padding: 0.2em 0.4em;
  background-color: #efefef;
  border-radius: 3px;
}

pre {
  .line {
    min-height: 1em;
  }
}

.highlight {
  position: relative;
  margin: 1em 0;
  border-radius: 2px;
  line-height: 1.1em;
  background-color: #f8f8f8;
  border: 1px solid #eeeeee;
  overflow-x: auto;
  table,
  tr,
  td {
    width: 100%;
    border-collapse: collapse;
    padding: 0;
    margin: 0;
  }
  .gutter {
    display: none;
  }
  .code pre {
    padding: 1.2em 1.4em;
    line-height: 1.5em;
    margin: 0;
  }
}

%code-base {
  position: absolute;
  top: 0;
  right: 0;
  color: #ccc;
  text-align: right;
  font-size: 0.75em;
  padding: 5px 10px 0;
  line-height: 15px;
  height: 15px;
  font-weight: 600;
}

@mixin code-signs($keys) {
  @each $key in $keys {
    .highlight.#{$key} .code:after {
      content: to-upper-case($key);
      @extend %code-base;
    }
  }
}

$signs: ("html", "js", "bash", "css", "scss", "diff", "java", "xml", "python", "json", "swift", "ruby", "perl", "php", "c", "java", "cpp", "ts");
@include code-signs($signs);
.highlight.cpp .code:after {
  content: 'C++';
}

pre {
  color: #525252;
  .function .keyword,
  .constant {
    color: #0092db;
  }
  .keyword,
  .attribute {
    color: #e96900;
  }
  .number,
  .literal {
    color: #ae81ff;
  }
  .tag,
  .tag .title,
  .change,
  .winutils,
  .flow,
  .lisp .title,
  .clojure .built_in,
  .nginx .title,
  .tex .special {
    color: #2973b7;
  }
  .symbol,
  .symbol .string,
  .value,
  .regexp {
    color: #42b983;
  }
  .title {
    color: #83B917;
  }
  .tag .value,
  .string,
  .subst,
  .haskell .type,
  .preprocessor,
  .ruby .class .parent,
  .built_in,
  .sql .aggregate,
  .django .template_tag,
  .django .variable,
  .smalltalk .class,
  .javadoc,
  .django .filter .argument,
  .smalltalk .localvars,
  .smalltalk .array,
  .attr_selector,
  .pseudo,
  .addition,
  .stream,
  .envvar,
  .apache .tag,
  .apache .cbracket,
  .tex .command,
  .prompt {
    color: #42b983;
  }
  .comment,
  .java .annotation,
  .python .decorator,
  .template_comment,
  .pi,
  .doctype,
  .shebang,
  .apache .sqbracket,
  .tex .formula {
    color: #b3b3b3;
  }
  .deletion {
    color: #BA4545;
  }
  .coffeescript .javascript,
  .javascript .xml,
  .tex .formula,
  .xml .javascript,
  .xml .vbscript,
  .xml .css,
  .xml .cdata {
    opacity: 0.5;
  }
}
